import Mock from 'mockjs'
import url from 'url'
import MonthWarn from "../../components/menu/MonthWarn";

//生成月能耗的数据
const {monthList} = Mock.mock({
    'monthList|30': [
        {
            'id|+1': 1,
            table_id:'@integer(99999900000,999999999999)',
            'name': '@cword(2,4)',
            start_end_date: '@date(yyyy-MM-dd hh:mm:ss)'+'--'+'@date(yyyy-MM-dd hh:mm:ss)',
            enc: '@integer(10000000,99999999)',
            consult:'@integer(1000000000000,1999999999999)',
        }
    ]
})

//生成日消耗的数据
const {dayList} = Mock.mock({
    'dayList|35': [
        {
            'id|+1': 1,
            table_id:'@integer(99999900000,999999999999)',
            'name': '@cword(2,4)',
            start_end_date: '@date(yyyy-MM-dd hh:mm:ss)'+'--'+'@date(yyyy-MM-dd hh:mm:ss)',
            enc: '@integer(10000000,99999999)',
            consult:'@integer(1000000000000,1999999999999)',
        }
    ]
})


//月消耗数据信息
Mock.mock('/api/module8/MonthCons','get',()=>{
    return {
        status: 200,
        message: '获取月消耗信息成功',
        list: monthList,
    }
})

//日消耗数据信息
Mock.mock('/api/module8/DayCons','get',()=>{
    return {
        status: 200,
        message: '获取月消耗信息成功',
        list: dayList,
    }
})

//月份搜索
Mock.mock(/\api\/module8\/Monthsearch/,'get',(options)=>{
    let {Mydate,num,avg} = url.parse(options.url,true).query;
    return {
        status: 200,
        message: '查询成功',
        list: monthList.slice(3,31),
    }
})

//日搜索
Mock.mock(/\api\/module8\/Daysearch/,'get',(options)=>{
    let {Mydate,num,avg} = url.parse(options.url,true).query;
    return {
        status: 200,
        message: '查询成功',
        list: dayList.slice(10,31),
    }
})
